<template>
	<!-- 商家让利 爆品 -->
	<view class="bgcf bdr20  mt20 p20">
		<view class="df aic jcsb mb20">
			<image style="width: 148rpx;height: 53rpx;" src="https://zhaimeibianli.oss-cn-hangzhou.aliyuncs.com/house/2024/07/01/c44e08d3eb9c43e9b5eed69214e47a55.png" mode="widthFix">
			</image>
			<view class="themeLabel cf pl14 pr14 fs22">
				商家让利，还不快来薅！
			</view>
		</view>
		<scroll-view scroll-x="true" class="" style="width: 650rpx;">
			<view class="df aic ">
				<view class="goods-item df aic mr20" v-for="item in list" @click="handleDetail(item)">
					<u-image :src="item.mixImage||''" width="140" height="140" borderRadius="10"></u-image>
					<view class="goods-item-info ml10">
						<view class="u-line-1 fs24 c3">
							{{item.customGoodsName||'--'}}
						</view>
						
						<template v-if="TOKEN">
							<view class="tag" >
								每单省￥{{mulPrice(item)}}
							</view>
							<view class="price-box fs24">
								<text class="price fwb">¥{{item.platformPrice||'0.00'}}</text><text class="c9 ml8 old-price">¥{{item.initPlatformPrice||'0.00'}}</text>
							</view>
						</template>
							<view class="price-box  df " @click="$emit('login')" v-else>
								<text class="price fwb ">登录可见价格</text>
							</view>
						
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
import Decimal from 'decimal.js'
	export default{
		props:{
			list:{
				type:Array,
				default:() =>[]
			}
		},
		methods:{
			mulPrice(item){
				let _price = new Decimal(item.initPlatformPrice||0).sub(item.platformPrice||0)
				return new Decimal(_price).toFixed(2)||'0.00'
			},
			handleDetail(item){
				uni.navigateTo({
					url:`/other/pages/dailySaleList?id=${item.platformGoodsSpecMixId}&sessionTime=${item.sessionTime}`
				})
			}
		},
		data(){
			return{
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	.themeLabel {
		background: linear-gradient(90deg, #48A147 0%, #8AE38A 100%);
		border-radius: 19rpx 0rpx 19rpx 0rpx;
		padding: 5rpx 20rpx 5rpx 20rpx;
		opacity: 1;
	}
	.goods-item{
		padding: 10rpx;
		width: 370rpx;
		background: linear-gradient( 88deg, #FFF0EA 0%, #F0FFF0 100%);
		border-radius: 10rpx 10rpx 10rpx 10rpx;
		.goods-item-info{
			width: 200rpx;
				
			.tag{
				padding: 1rpx 10rpx;
				font-size: 22rpx;
				color: white;
				border-radius: 10rpx;background: #EF2929;
				display: inline-block;
			}
			.price-box{
				.old-price{
					text-decoration: line-through;
				}
			}
		}
	}
</style>